
package com.idealighter.game.games.errentexaspoker.handler;

import com.idealighter.game.core.annotation.ResMsgHandler;
import com.idealighter.game.games.errentexaspoker.ErrenTexaspokerPlayer;
import com.idealighter.game.games.errentexaspoker.message.ReqDealCardOverMsg;
import com.idealighter.game.games.errentexaspoker.message.ResHiddenCardsMsg;
import com.idealighter.game.message.core.ResMessage;
import com.idealighter.game.robot.core.Player;
import com.idealighter.game.robot.handler.ResMessageHandler;
import com.idealighter.utils.code.RandCodeUtil;

import java.util.concurrent.TimeUnit;


@ResMsgHandler(515206)
public class ResHiddenCardsHandler implements ResMessageHandler {

  @Override
  public void action(Player player, ResMessage message) {
    ResHiddenCardsMsg msg = (ResHiddenCardsMsg) message;
    ErrenTexaspokerPlayer texaspokerPlayer = (ErrenTexaspokerPlayer) player;
    texaspokerPlayer.curBet = 0;
    texaspokerPlayer.getCardList().addAll(msg.getCards());
    player.schedule(() -> player.sendMsg(new ReqDealCardOverMsg()), RandCodeUtil.random(3, 5),
        TimeUnit.SECONDS);
  }

}
